import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpDistributeGrade {
  id!: number;
  grade!: number;
  name!: string;
  isAuto!: boolean;
  autoType!: boolean;
  autoNumber!: number;
  courseDis!: boolean;
  courseCommissionType!: boolean;
  courseCommission1!: string;
  courseCommission2!: string;
  courseCommission3!: string;
  vipDis!: boolean;
  vipCommissionType!: boolean;
  vipCommission1!: string;
  vipCommission2!: string;
  vipCommission3!: string;
  goodDis: boolean = true;
  goodCommissionType: boolean = true;
  goodCommission1!: string;
  goodCommission2!: string;
  goodCommission3!: string;
  enrollDis: boolean = true;
  enrollCommissionType: boolean = true;
  enrollCommission1!: string;
  enrollCommission2!: string;
  enrollCommission3!: string;
  state!: boolean;
  content?: unknown;
  uniacid!: number;
  addTime?: string;
  updateTime?: string;
}

export const ImsYzdKpDistributeGradeSchema = new EntitySchema({
  class: ImsYzdKpDistributeGrade,
  properties: {
    id: { primary: true, type: 'number' },
    grade: { type: 'number', index: 'grade' },
    name: { type: 'string', length: 255 },
    isAuto: { type: 'boolean', index: 'is_auto' },
    autoType: { type: 'boolean', index: 'auto_type' },
    autoNumber: { type: 'number' },
    courseDis: { type: 'boolean', index: 'course_dis' },
    courseCommissionType: { type: 'boolean', index: 'course_commission_type' },
    courseCommission1: {
      type: 'string',
      fieldName: 'course_commission_1',
      columnType: 'numeric(10,2)',
    },
    courseCommission2: {
      type: 'string',
      fieldName: 'course_commission_2',
      columnType: 'numeric(10,2)',
    },
    courseCommission3: {
      type: 'string',
      fieldName: 'course_commission_3',
      columnType: 'numeric(10,2)',
    },
    vipDis: { type: 'boolean', index: 'vip_dis' },
    vipCommissionType: { type: 'boolean', index: 'vip_commission_type' },
    vipCommission1: { type: 'string', fieldName: 'vip_commission_1', columnType: 'numeric(10,2)' },
    vipCommission2: { type: 'string', fieldName: 'vip_commission_2', columnType: 'numeric(10,2)' },
    vipCommission3: { type: 'string', fieldName: 'vip_commission_3', columnType: 'numeric(10,2)' },
    goodDis: { type: 'boolean', default: true },
    goodCommissionType: { type: 'boolean', default: true },
    goodCommission1: {
      type: 'string',
      fieldName: 'good_commission_1',
      columnType: 'numeric(10,2)',
      defaultRaw: `20.00`,
    },
    goodCommission2: {
      type: 'string',
      fieldName: 'good_commission_2',
      columnType: 'numeric(10,2)',
      defaultRaw: `10.00`,
    },
    goodCommission3: {
      type: 'string',
      fieldName: 'good_commission_3',
      columnType: 'numeric(10,2)',
      defaultRaw: `5.00`,
    },
    enrollDis: { type: 'boolean', default: true },
    enrollCommissionType: { type: 'boolean', default: true },
    enrollCommission1: {
      type: 'string',
      fieldName: 'enroll_commission_1',
      columnType: 'numeric(10,2)',
      defaultRaw: `20.00`,
    },
    enrollCommission2: {
      type: 'string',
      fieldName: 'enroll_commission_2',
      columnType: 'numeric(10,2)',
      defaultRaw: `10.00`,
    },
    enrollCommission3: {
      type: 'string',
      fieldName: 'enroll_commission_3',
      columnType: 'numeric(10,2)',
      defaultRaw: `5.00`,
    },
    state: { type: 'boolean', index: 'state' },
    content: { type: 'unknown', columnType: 'longtext', nullable: true },
    uniacid: { type: 'number', index: 'uniacid' },
    addTime: { type: 'string', length: 255, nullable: true },
    updateTime: { type: 'string', length: 255, nullable: true },
  },
});
